﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace ConsoleApp1
{
    class ReadOnlyCollection : IEnumerable
    {
        private int[] array;
        public ReadOnlyCollection(int[] array)
        {
            this.array = array;
            
        }
        public IEnumerator GetEnumerator()
        {
            return new Enumerator(this);
        }

        public class Enumerator : IEnumerator
        {
            private ReadOnlyCollection readOnlyCollection;
            private int index;
            public Enumerator(ReadOnlyCollection readOnlyCollection)//快捷ator
            {
                this.readOnlyCollection = readOnlyCollection;
                index = -1;
            }
            public object Current
            {
                get
                {
                    object o = readOnlyCollection.array[index];
                    return o;
                }
            }
            public bool MoveNext()
            {
                if(++index<readOnlyCollection.array.Length)
                {
                    return true;
                }
                return false;
            }

            public void Reset()
            {
                index = -1;
            }
        }
    }
    class Program
    {
        /*static void Main(string[] args)
        {
            int[] nums = { 1, 2, 3, 4, 5, };
            ArrayList nums2 = new ArrayList { 1, 2, 3, 4, 5 };

            var res = new ReadOnlyCollection(nums);

            foreach (var i in res)
            {
                Console.WriteLine(i);
            }

            var c = new WK();
            c.ss();

            ILove b=new WK();
            b.s();
        }*/
    }

    interface ILove
    {
          void s();
    }
    interface IKill
    {
         void ss();
    }
    class WK : ILove, IKill
    {
        public void ss(){}

        //显示声明 
        void ILove.s(){}
    }
}


    

